

export default {
   namespaced: true,
    state: {
        name: 'test',
        age: 18,
        sex: '男',
        token: ''
      },
      mutations: {
        SET_NAME (state: any, payload: string) {
           state.name = payload
        },
        SET_TOKEN (state: any, payload: string) {
            state.token = payload
         }
      },
      actions: {
        Login({commit}: any, payload: object) {
           console.log(payload)
           // 1. 发送http请求 res = Http.login(payload)
           setTimeout(() => {
            // 2. 拿到token之后更新state.token // res.data.token
            commit('SET_TOKEN', '122222xxxf')
           }, 2000)
        }
      
      }

}